<html data-dpr="1" style="font-size: 35.8px;">

	<head>
		<meta charset="utf-8">
		<meta content="telephone=no" name="format-detection">
		<meta content="email=no" name="format-detection">
		<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Expires" content="0">
		<link rel="stylesheet" href="css/style.css">
		<title>三月会员日</title>
		<script src="https://cdn.jsdelivr.net/npm/vue"></script>
		<!--		<script src="https://unpkg.com/vue-lazyload/vue-lazyload.js"></script>
-->
		<style>

		</style>
		<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
	</head>

	<body style="font-size: 12px;">

	<div id="aa">
		<div class="w">
			<div id="content" class="cCenter">
				<header v-for=" value in pic">
					<img :src="value "> <br>
				</header>
				<!-- 商品 -->
				<div v-for=" parent,value in  list_mapGoods">

					<div class="floor" name="tab">
						<!-- 商品banner -->
						<div class="banner pt4" style="background: #4a8c42">
							<img :src="parent.sectionPic">
						</div>
						<div class="proFloor clearfix">
							<div v-for="good in parent.list_goods ">

								<div class="proAlone">
									<div class="proPic">
										<a href="#" target="_blank" class="proA"><img
												:src="good.thumbnail" :onerror="defaultImg"
												style="display: block;"></a>
									</div>
									<div class="proName">
										<a href="#" target="_blank"> {{good.goodsName}}</a>
									</div>
									<div class="proPrice">
										<div class="proP clearfix">
											<p class="priceNew"><b>{{good.price}}</b></p>
											<p class="priceOld">{{good.linePrice}}</p>
										</div>
										<div class="proBtn">

											<a href="javascript:" class="cart-icon"
											   @click="addshoop(good.skuId)" :data-id="good.skuId">加入购物车</a>
										</div>
									</div>
								</div>

							</div>

						</div>
					</div>
					<br>
				</div>

				<!-- 返回顶部 -->
				<div class="backtop-btn">
					<img :src="page.footer">
				</div>
			</div>
		</div>
		<script src="js/jquery.min.js"></script>
		<script type="text/javascript">
				$(function() {

					//		跳回到顶部	

					$(".backtop-btn").click(function() {
						$('html, body').animate({
							scrollTop: 0
						}, 500, 'swing')

					})

				})

		</script>

		<script>
				//显示错误提示
				function errorTipsShow(e) {
					if($('.error-tips').length == 0) {
						$('body').append('<div class="error-tips"></div>');
					}
					$(".error-tips").html(e).show();
					setTimeout(function() {
						$(".error-tips").addClass('error-tips-visible').addClass('error-tips-transition');
					}, 10);
					setTimeout(function() {
						errorTipsHide();
					}, 3e3);
				}
				//关闭错误提示
				function errorTipsHide() {
					$(".error-tips").removeClass('error-tips-visible');
					setTimeout(function() {
						$(".error-tips").remove();
					}, 200);
				}

				uuid = "b485bcb2024a11e88308902b340f4796";

				function createADGoodsDelegateUUID(UUID){
					uuid = UUID;
					$(".error-tips").html(UUID).show();
				}

				templatePageId = "1";
				new Vue({
					el: '#aa', //div的id
					data: {
						page: "", //模板的页面表 
						pic: "",
						articleInfo: "123", //数据，名称自定
						content: "",
						all_goods: "",
						list_mapGoods: "",
						defaultImg: 'this.src="' + ('https://fairy-demo-1712.oss-cn-shanghai.aliyuncs.com/winter/loading_1.jpg') + '"', //图片出错的时候显示
					},
					created: function() { //created方法，页面初始调用    
						var url = 'http://api.c-fairy.net:8080/api-restservice/getTemplatePageById?uuid=' + uuid + '&templatePageId=' + templatePageId;
						let self = this;  
						$.ajax({
							type : "post",
			                url : url,	
						    dataType : "jsonp",
			                success : function(data) {
			               /* if (data && data.data) {  // 如果查到数据*/  
                            self.list_mapGoods = data.data.list_templateGoods;
			                self.all_goods = self.list_mapGoods.list_goods;
							self.page = data.data;
							self.pic = self.page.pic;           
			               /* }*/
			                }
			              }
						)	
						
				/*		axios.post(url).then(function(resp) { //ajax请求封装
							//我的json数据
							console.log("sj2" + resp.data.data.list_templateGoods);
							this.list_mapGoods = resp.data.data.list_templateGoods;
							this.all_goods = this.list_mapGoods.list_goods;
							this.page = resp.data.data;
							this.pic = this.page.pic;

							console.log("sj" + this.defaultImg);
						}.bind(this)).catch(function(error) {
							console.log("失败" + error);
						});*/

					},
					methods: {
						addshoop(id) {
							console.log("加入购物车id" + id)
							var url = 'http://api.c-fairy.net:8080/api-restservice/addToShoppingCart?uuid=' + uuid + '&skuId=' + id;
						$.ajax({
							type : "post",
			                url : url,
						    dataType : "jsonp",
			                success : function(data) {
			                console.log(data)	
                            if(data.code == "1") {
									errorTipsShow('加入购物车成功')
								} else {
									errorTipsShow('加入购物车失败')
								} 
			                }
			              }
						)
						
						
						
						
						/*	axios.post(url).then(function(resp) { //ajax请求封装
								console.log("sj " + resp.data.code);
								if(resp.data.code == "1") {
									errorTipsShow('加入购物车成功')
								} else {
									errorTipsShow('加入购物车失败')
								}

							}.bind(this)).catch(function(error) {
								console.log("失败" + error);
							});*/

						},

					}
				});

		</script>

	</div>
	</body>

</html>